<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>骨架屏 - 组件演示</title>
    <link rel="stylesheet" href="../css/style.css">
    <link rel="stylesheet" href="../components/skeleton/skeleton.css">
</head>
<body>
    <div class="container">
        <header class="header">
            <h1>🚀 openHarmony_Cordova_NutpiDesign</h1>
            <p class="subtitle">组件演示 - 骨架屏</p>
        </header>

        <nav class="demo-nav">
            <a href="../index.html" class="nav-back">← 返回首页</a>
        </nav>

        <main class="main-content">
            <section class="demo-section">
                <h2>💀 骨架屏演示</h2>
                
                <div class="demo-container">
                    <div class="demo-item" style="grid-column: 1 / -1;">
                        <h3>文本骨架屏</h3>
                        <div id="textSkeleton"></div>
                    </div>

                    <div class="demo-item" style="grid-column: 1 / -1;">
                        <h3>头像骨架屏</h3>
                        <div id="avatarSkeleton"></div>
                    </div>

                    <div class="demo-item" style="grid-column: 1 / -1;">
                        <h3>卡片骨架屏</h3>
                        <div id="cardSkeleton"></div>
                    </div>

                    <div class="demo-item" style="grid-column: 1 / -1;">
                        <h3>列表骨架屏</h3>
                        <div id="listSkeleton"></div>
                    </div>

                    <div class="demo-item" style="grid-column: 1 / -1;">
                        <h3>多个卡片骨架屏</h3>
                        <div id="multiCardSkeleton"></div>
                    </div>

                    <div class="demo-item" style="grid-column: 1 / -1;">
                        <h3>小尺寸骨架屏</h3>
                        <div id="smallSkeleton"></div>
                    </div>

                    <div class="demo-item" style="grid-column: 1 / -1;">
                        <h3>大尺寸骨架屏</h3>
                        <div id="largeSkeleton"></div>
                    </div>

                    <div class="demo-item" style="grid-column: 1 / -1;">
                        <h3>无动画骨架屏</h3>
                        <div id="noAnimationSkeleton"></div>
                    </div>
                </div>
            </section>

            <section class="demo-section">
                <h2>使用代码</h2>
                <pre><code>// 1. 引入文件
&lt;link rel="stylesheet" href="components/skeleton/skeleton.css"&gt;
&lt;script src="components/skeleton/skeleton.js"&lt;/script&gt;

// 2. 创建容器
&lt;div id="skeletonContainer"&lt;/div&gt;

// 3. 初始化骨架屏组件
const skeleton = new Skeleton({
    container: '#skeletonContainer',
    type: 'card',
    count: 3,
    animated: true,
    size: 'medium'
});

// 4. 改变类型
skeleton.setType('list');

// 5. 改变大小
skeleton.setSize('large');

// 6. 清空骨架屏
skeleton.clear();</code></pre>
            </section>
        </main>

        <footer class="footer">
            <p>&copy; 2025 OpenHarmony 三方库适配中心 | MIT License</p>
        </footer>
    </div>

    <script src="../components/skeleton/skeleton.js"></script>
    <script>
        // 文本骨架屏
        new Skeleton({
            container: '#textSkeleton',
            type: 'text',
            rows: 3
        });

        // 头像骨架屏
        new Skeleton({
            container: '#avatarSkeleton',
            type: 'avatar'
        });

        // 卡片骨架屏
        new Skeleton({
            container: '#cardSkeleton',
            type: 'card'
        });

        // 列表骨架屏
        new Skeleton({
            container: '#listSkeleton',
            type: 'list',
            rows: 5
        });

        // 多个卡片骨架屏
        new Skeleton({
            container: '#multiCardSkeleton',
            type: 'card',
            count: 3
        });

        // 小尺寸骨架屏
        new Skeleton({
            container: '#smallSkeleton',
            type: 'text',
            size: 'small',
            rows: 2
        });

        // 大尺寸骨架屏
        new Skeleton({
            container: '#largeSkeleton',
            type: 'card',
            size: 'large'
        });

        // 无动画骨架屏
        new Skeleton({
            container: '#noAnimationSkeleton',
            type: 'list',
            rows: 3,
            animated: false
        });
    </script>

    <style>
        .demo-container {
            display: grid;
            grid-template-columns: 1fr;
            gap: 20px;
            margin-bottom: 20px;
        }

        .demo-item {
            background: var(--bg-light);
            padding: 16px;
            border-radius: 8px;
            overflow: visible;
            position: relative;
        }

        .demo-item h3 {
            margin-top: 0;
            margin-bottom: 16px;
            font-size: 14px;
            color: var(--text-primary);
        }

        @media (max-width: 768px) {
            .demo-container {
                grid-template-columns: 1fr;
            }
        }
    </style>
</body>
</html>
